<?php
class OnlineQuestionServer {
	public function question($question){
		$data['add_time'] = time();
		$data['user_id'] = $_SESSION['user']['id'];
		$data['question'] = $question;
		HttpDaoManager::getOnlineQuestionDao()->add($data);
	}
	public function answer($answer,$id){
		$data['admin_id'] = $_SESSION['admin']['id'];
		$data['answer'] = $answer;
		$data['answer_time'] = time();
		HttpDaoManager::getOnlineQuestionDao()->update($data, $id);
	}
	public function pagingBySearch($where="",$order='',$numberEachPage = 10){
		$count = HttpDaoManager::getOnlineQuestionDao()->searchNumber($where);
		$page = new Page($count, $numberEachPage);
		$limit[0]= $page->which;
		$limit[1]=$numberEachPage;
		$list = HttpDaoManager::getOnlineQuestionDao()->searchList($where,$order, $limit);
		$page1= $page->returnPage("?".ClassManager::getToos()->combinationGet('page')."&page=");
		$data['list'] =$list;
		$data['page'] = $page1;
		return $data;
	}
	public function deleteBatchByid($id){
		if (is_array($id)){
			$id = implode(',',$id);
		}
		HttpDaoManager::getOnlineQuestionDao()->deleteBatchByid($id);
	}
}

?>